package com.neusoft.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;

import com.neusoft.po.Orders;

@Mapper
public interface OrdersMapper {

	@Insert("insert into orders(userId,businessId,orderDate,orderTotal,daId,orderState,riderId) values(#{userId},#{businessId},#{orderDate},#{orderTotal},#{daId},0,1)")
	@Options(useGeneratedKeys = true, keyProperty = "orderId", keyColumn = "orderId")
	public int saveOrders(Orders orders);

	public Orders getOrdersById(Integer orderId);

	public List<Orders> listOrdersByUserId(String userId);

	@Update("update orders set orderState=1 where orderId=#{orderId}")
	public void updateOrderStateById(Integer orderId);
}
